<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/cloudiary.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Cloudiary</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->

<!-- InstanceEndEditable -->
<link href="CSS/css.css" rel="stylesheet" type="text/css" />
</head>
<?php
include('adminlock.php');
?>
<body>

<div id="container">
<div id="wrapper">

<div id="header">
<!-- InstanceBeginEditable name="header" -->
<div class="welcome">
<?php include('welcomeadmin.php'); ?>
</div>
<!-- InstanceEndEditable -->

<img src="Assets/cloud diary low-01(trans).png" alt="CloudDiary" width="75" height="45" style="padding:5px 10px;" /> <br />
</div>

<div id="main">
	<!-- InstanceBeginEditable name="Main" -->
<div id="admin">
  <?php  
  
    $single_page=3;
    $query="SELECT * FROM user where is_admin = 0";
    $query_name=mysql_query($query);
    $count=mysql_num_rows($query_name);
    $total_pages=ceil($count/$single_page);

    if(isset($_GET['page']) && is_numeric($_GET['page']))
    {
      $obtain_page=$_GET['page'];
      if($obtain_page>0 && $obtain_page<=$total_pages)
      {
        $starting_page=($obtain_page-1)*$single_page;
        $ending_page=$starting_page+$single_page;
      }
      else
      {
        $starting_page=0;
        $ending_page=$starting_page+$single_page;
      }
    }
    else
    {
      $starting_page=0;
      $ending_page=$starting_page+$single_page;
    }  
?>
<div id="page">
<?php
    echo" <br /> <strong> Page:&nbsp; </strong>";
    for($a=1;$a<=$total_pages;$a++)
    {
      echo"<a href='AdminAccounts.php?page=$a'>$a</a>"." | ";
    }
?>
</div>
<?php
    echo"</p>";
	
    $q = $query . " LIMIT $starting_page,$single_page";
    $q=mysql_query($q);
    
    if($count==0)
    {
      echo "No posts to show for this user";
    }
?>  
    

    
    <?php
      for($a=$starting_page;$a<$ending_page;$a++)
      {
        if($a==$count)
        {
          break;
        }
        
        while($data_fetch=mysql_fetch_array($q))
        { 
        ?>

          <table border="0" width="100%">
          <tr>
          <td width="25" rowspan="3">&nbsp;  </td>
          <td colspan="4">&nbsp;  </td> 
          <td width="25" rowspan="3">&nbsp;  </td>
          </tr>
          
          <tr> 
          <td width="150" align="center">
          <img src="display_photo.php?id=<?php echo $data_fetch['user_email']; ?>" alt="User picture"  width="150" height="170" style="border:1px solid #69F; padding:2px" /> </td>
          <td width="20"> </td>
          <td style="border-left:solid 1px #69F">
                
        <?php
          echo "<p> &nbsp; Name: ";
          echo $data_fetch['user_name']."</p>";     

          echo "<p> &nbsp; User Email: ";
          echo $data_fetch['user_email']."</p>";
          
          echo "<p> &nbsp; DOB: ";
          echo $data_fetch['user_dob']."</p>";
                 
          echo "<p> &nbsp; Gender: ";
          echo $data_fetch['user_gender']."</p>";
          
          echo "<p> &nbsp; Country: ";
          echo $data_fetch['user_country']."</p>";
                               
          echo "<p> &nbsp; Join on: ";
          echo $data_fetch['user_join']."</p>";
          echo "</td>";
    ?>    
          
          <td width="200px" align="right">
          <p>
            <form name="view" action="AdminPosts.php" method="POST" class="view_button">
              <input type="hidden" name="viewID" value="<?php echo $data_fetch["user_email"]; ?>"/>
              <input type="image" src="Assets/buttonView.png" value="View" />
            </form>
          </p>
      
          <p>
            <form name="delete" action="SQL.php" method="POST" class="delete_button">
              <input type="hidden" name="query" value="<?php echo "DELETE FROM user WHERE user_email='".$data_fetch['user_email']."'"; ?>"/>
			  <input type="hidden" name="location" value="<?php echo "AdminAccounts.php"; ?>"/>
              <input type="image" src="Assets/buttonDelete.png" value="Delete" />
            </form>
          </p>
          
          </td>
    </tr>
          <tr> <td colspan="4"  style="border-bottom:solid 1px #69F;">&nbsp;  </td> </tr>
          </table>
  
    <?php      
        }
      }
    ?>
    
  
</div>
    <!-- InstanceEndEditable -->
</div>

</div>
</div>

<div id="footer">
<p align="center"> &copy; &nbsp; 2012 CloudDiary </p>
</div>
</body>
<!-- InstanceEnd --></html>
